package controller.util;

import java.util.List;
import java.util.Map;
import javafx.scene.chart.AreaChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;


/*
 * Monta as grafico dos histogramas...
 */
public class MountAreaChart extends AreaChart<Number, Number> {

    private Map<String, List> numbers;

    public MountAreaChart(Map<String, List> numbers,double width, double height) {
        super(new NumberAxis(), new NumberAxis(0, 255, 5));
        this.numbers = numbers;
        init();
        setMaxWidth(width);
        setMaxHeight(height);
    }

    private void init() {
        for (Map.Entry<String, List> entry : numbers.entrySet()) {
            XYChart.Series series = new XYChart.Series<>();
            series.setName(entry.getKey());
            List list = entry.getValue();
            for (int i = 0; i < list.size(); i++) {
                series.getData().add(new XYChart.Data<>(i, list.get(i)));
            }
            getData().addAll(series);
        }
        
    }

}
